﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class Demo02 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string username = (string)Session["username"];
            if (username!= null)
            {
                Response.Write($"<b>您的用户为：{username}!</b>");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string username = (string)Session["username"];
            string password = (string)Session["password"];
            if (username== TextBox1.Text && password== TextBox2.Text)
            {
                Literal1.Text = "登陆成功!";
                Response.Redirect("Index.aspx");
            }
            else
            {
                Literal1.Text = "输入错误，请重新输入！";
            }
        }
    }
}